package com.jacobson.huobi.mvp.fragment

import android.os.Bundle
import com.jacobson.core.base.FragmentImmersive
import com.jacobson.core.di.components.AppComponent
import com.jacobson.huobi.R
import com.jacobson.huobi.common.BaseSelectableFragment
import com.jacobson.huobi.di.components.DaggerHomeFragmentComponent
import com.jacobson.huobi.di.modules.HomeFragmentModule
import com.jacobson.huobi.mvp.contract.HomeContract
import kotlinx.android.synthetic.main.fragment_home.*

@FragmentImmersive
class HomeFragment : BaseSelectableFragment<HomeContract.Presenter>(), HomeContract.View {
    override fun setupFragmentComponent(appComponent: AppComponent) {
        DaggerHomeFragmentComponent.builder()
            .appComponent(appComponent)
            .homeFragmentModule(HomeFragmentModule(this))
            .build()
            .inject(this)
    }

    override fun initView(savedInstanceState: Bundle?): Int = R.layout.fragment_home

    override fun initData(savedInstanceState: Bundle?) {
        commonHeader.setForcePadding(true)
    }

    companion object {
        fun getInstance(): HomeFragment {
            return INSTANCE
        }

        private val INSTANCE = HomeFragment()
    }
}